package com.demo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.demo.dao.BaseFileDao;
import com.demo.datasource.DataSourceContextHolder;
import com.demo.entity.BaseFile;
import com.demo.service.BaseFileService;

/**
 * <p>
 * 栏目管理  服务实现类
 * </p>
 *
 * @author xj
 * @since 2017-01-05
 */
@Service
public class BaseFileServiceImpl implements BaseFileService {

	@Autowired
	private	BaseFileDao baseFileDao;
	
	@Override
	public List<BaseFile> selectUnUploadFileList() {
		DataSourceContextHolder.setDbType("one");
		return baseFileDao.selectUnUploadFileList();
	}


	@Override
	public boolean myUploadFile(BaseFile baseFile) {
		return baseFileDao.myUploadFile(baseFile);
	}


	@Override
	public int updateUploadFile(String sid) {
		DataSourceContextHolder.setDbType("one");
		return baseFileDao.updateUploadFile(sid);
	}


	@Override
	public int updateIndexUpload(Integer id) {
		DataSourceContextHolder.setDbType("one");
		return baseFileDao.updateIndexUpload(id);
	}



	public int insert(BaseFile baseFile) {
		DataSourceContextHolder.setDbType("two");
		return baseFileDao.insert(baseFile);
	}

	public int update(BaseFile baseFile) {
		DataSourceContextHolder.setDbType("one");
		return baseFileDao.update(baseFile);
	}
	
}
